package com.beiye.drivertransport.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ky on 2018/1/3.
 */

public class LearnCarAdapter extends FragmentPagerAdapter {
    //存储所有的fragment
    private List<Fragment> list;
    private List<String> list_Title; //tab名的列表
    public LearnCarAdapter(FragmentManager fm, ArrayList<Fragment> list, List<String> list_Title){
        super(fm);
        this.list = list;
        this.list_Title = list_Title;
    }

    @Override
    public Fragment getItem(int arg0) {
        // TODO Auto-generated method stub

        return list.get(arg0);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list_Title.size();
    }
    //此方法用来显示tab上的名字
    @Override
    public CharSequence getPageTitle(int position) {
        return list_Title.get(position % list_Title.size());
    }

}
